package great.project.easyexcel.demo;

import great.project.easyexcel.controller.TestController;
import great.project.easyexcel.easyexcel.bo.ExcelErrorMessage;
import great.project.easyexcel.easyexcel.bo.ExcelProgress;
import great.project.easyexcel.mock.ProcessMock;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@EnableScheduling
@Component
public class Task {

    /**
     *   <div  style="height:10px;width:200px;font-size:15px;text-align:center;color:red;">
     *
     *  testController
     *
     *  </div>
     */
    @Resource
    private TestController testController;

    /**
     *   <div  style="height:10px;width:200px;font-size:15px;text-align:center;color:red;">
     *
     *  processMock
     *
     *  </div>
     */
    @Resource
    private ProcessMock processMock;


    @Scheduled(fixedDelay = 1000)
    public void task(){

        List<Student> data_list = testController.DATA_LIST;
        if (!data_list.isEmpty()) {
            System.out.println("导入的总数据："+data_list.size());
        }

        Map<String, ExcelProgress> processMap = processMock.processMap;
        processMap.forEach((k,v)-> System.out.println(k + ":进度信息:" + v.toString()));

        Map<String, List<ExcelErrorMessage>> errorMessageMap = processMock.errorMessageMap;

        errorMessageMap.forEach((k,v)-> System.out.println(k + ":错误信息:" + v.size()));

    }


}
